feat: signed webhook delivery with retries and dead-letter queue - #559
Open
ZacLou wants to merge 1 commit into
Open
feat: signed webhook delivery with retries and dead-letter queue#559ZacLou wants to merge 1 commit into
ZacLou wants to merge 1 commit into
Conversation
…bleRoute-Org#552) - HMAC-SHA256 payload signing with timestamp (X-Signature header) - Signature verification helper for subscribers (with replay protection) - Bounded retry with exponential backoff + jitter on 5xx/timeout - No retry on 4xx (immediate dead-letter) - Dead-letter queue for exhausted deliveries - GET /api/v1/webhooks/dead-letter — list dead-lettered entries - POST /api/v1/webhooks/dead-letter/:id/replay — replay a failed delivery - DELETE /api/v1/webhooks/dead-letter — clear the queue - Configurable via env vars (max attempts, backoff, timeout, max payload) - 19 unit tests covering signing, verification, backoff, delivery, retry, DLQ Closes StableRoute-Org#552
Author
|
Hi @mikewheeleer — the CI workflows on this PR are stuck in awaiting approval (first-time contributor runs need a maintainer to click approve). Could you approve the workflow runs so the checks can execute? Happy to address anything the checks surface. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #552
Build a delivery pipeline with HMAC signing, bounded retries with backoff, and a dead-letter queue for exhausted deliveries.
What this PR adds
1. HMAC Payload Signing (webhookDelivery.ts)
signPayload()— signs with HMAC-SHA256, returnst=<timestamp>,v1=<hex-signature>headerverifySignature()— verifies signature with replay protection (configurable tolerance window)timingSafeEqualto prevent timing attacksX-Signature,X-Webhook-Id,X-Webhook-Eventheaders2. Bounded Retries with Exponential Backoff
WEBHOOK_MAX_ATTEMPTS, default 5)WEBHOOK_INITIAL_BACKOFF_MS)WEBHOOK_TIMEOUT_MS)3. Dead-Letter Queue
GET /api/v1/webhooks/dead-letter— list dead-lettered entriesPOST /api/v1/webhooks/dead-letter/:id/replay— replay a failed delivery (removes from DLQ on success)DELETE /api/v1/webhooks/dead-letter— clear the queue4. Configuration (env vars)
WEBHOOK_SIGNING_SECRET— HMAC secretWEBHOOK_MAX_ATTEMPTS— max retry attempts (default: 5)WEBHOOK_INITIAL_BACKOFF_MS— initial backoff (default: 1000)WEBHOOK_MAX_BACKOFF_MS— max backoff cap (default: 30000)WEBHOOK_TIMEOUT_MS— per-request timeout (default: 10000)WEBHOOK_MAX_PAYLOAD_BYTES— max payload size (default: 65536)Acceptance criteria met
X-Signature+ timestamp) subscribers can verifyTests
19 unit tests covering: